<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>机构端</title>
		<script src="/Public/static/jquery-2.0.3.min.js"></script>
        <script src="/Public/static/layer/layer.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
	</head>

	<body class="agency_box contentBox pos_rel dpflxr">
		<!-- 1.顶部logo导航 -->
		<include file="head" />

		<!-- 2.垂直导航 -->
		<div class="navColumn">
			<a href="{:U('Mechanism/index')}" <if condition="$cur eq '信息设置'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='1'>
				<div class="lineColumn pos_abs"></div>
				<label for="">信息设置</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/department_manage')}" <if condition="$cur eq '部门管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='2'>
				<div class="lineColumn pos_abs"></div>
				<label for="">部门管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/staff')}" <if condition="$cur eq '员工管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='3'>
				<div class="lineColumn pos_abs"></div>
				<label for="">员工管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/role_manage')}" <if condition="$cur eq '权限管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='4'>
				<div class="lineColumn pos_abs"></div>
				<label for="">权限管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/punch_record')}" <if condition="$cur eq '打卡记录'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='5'>
				<div class="lineColumn pos_abs"></div>
				<label for="">打卡记录</label>
				<div class="rightArrow">
				</div>
			</a>
		</div>


		<!-- 3.垂直导航分类页面 -->
	
		<!-- 3.3 员工管理  -->
		<div class="contentArea tabPage actived">
			
			<!-- 3.3.2 新增员工 -->
			<div id="appendEmployee" >
				
				<div class="caTitleBox dpflxr">
					<label for="" class="caTitle">新增员工</label>	
				</div>
				<div class="card switchPage">
				<div class="contentItem upload dpflxr">
					<label for="" class="title">头像：</label>
					<div class="image im">
						<if condition="$info['img'] neq ''"><img src="{$info.img}"></if>
					</div>
					<div class="btn">
						<label for=""  id="cc">上传头像</label>
					</div>
				</div>
				<form action="" method="POST">
					<div class="dpflxr">
						<div class="contentItem  dpflxr">
							<label for="" class="title">姓名：</label>
							<input type="text" class="inputBox" name="staff_name" value="{$info.staff_name}" placeholder="请输入姓名"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">联系方式：</label>
							<input type="text" class="inputBox" name="mobile" value="{$info.mobile}" placeholder="请输入联系方式"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">性别：</label>
							
							<select name="sex" id="" class="selectBox">
								<option value="1" <if condition="$info['sex'] eq 1">selected</if>>男</option>
								<option value="2" <if condition="$info['sex'] eq 2">selected</if>>女</option>
							</select>
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">联系地址：</label>
							<input type="text" class="inputBox" name="address" value="{$info['address']}" placeholder="请输入联系地址"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">所属部门：</label>
							
							<select name="department_id" id="" class="selectBox">
<!-- 								<option value="">请选择</option> -->
								<volist name="de_list" id="item">
									<option value="{$item.id}" <if condition="$item['id'] eq $info['department_id']">selected</if>>{$item.name}</option>
								</volist>
							</select>
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">角色：</label>
							
							<select name="role" id="" class="selectBox">
								<option value="1" <if condition="$info['role'] eq 1">selected</if>>置业顾问</option>
								<option value="2" <if condition="$info['role'] eq 2">selected</if>>管理人员</option>
							</select>
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">状态：</label>
							
							<select name="status" id="" class="selectBox">
								<option value="1" <if condition="$info['status'] eq 1">selected</if>>正常</option>
								<option value="2" <if condition="$info['status'] eq 2">selected</if>>禁用</option>
							</select>
						</div>
					</div>
					
					<input type="hidden" name="img">
					<input type="hidden" name="id" value="{$info.id}">
					<button type="submit"  class="ciBtn">保存</button>
				</div>
			</div>
			</form>
					
			
		</div>
		
		
		
	

		
	</body>
</html>
<script type="text/javascript">
$("body").on('click','#cc',function(){
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg(files[i],thisObj);
        }
    });
});
function uploadImg(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='img']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}
</script>